const db = require('../../../libs/MyDB')

module.exports = {
    //根据前端发送到id取数据
    //详情页课程信息
    detailspage: async function(req,res) {
        let result = {}
        await db.multiSelect('study_course', ['course_id','ctitle', 'signup_number', 'ctype', 'collection_number'], `course_id = ${req.body.courseid}`)
            .then(res => result = res);
        return result
    },
    //取对应id的课程章节
    coursechapters: async function(req,res) {
        return await db.relatedSelect('*', 'study_section', 'study_course', 'course_id', `a.course_id = ${req.body.courseid}`);
    }
}